package tmproject.hlhj.fhp.cartrans.presenter

import android.content.Context
import com.example.mymvp.BasePresenter
import tmproject.hlhj.fhp.cartrans.IView.HomeView
import tmproject.hlhj.fhp.cartrans.javaBean.DriverInfoBean
import tmproject.hlhj.fhp.cartrans.javaBean.LearInfoBean
import tmproject.hlhj.fhp.cartrans.javaBean.UnReadNumBean
import tmproject.hlhj.fhp.cartrans.modules.HomeModule

/**
 * Created by Administrator on 2018/8/26/026.
 */
class HomePresenter :BasePresenter<HomeModule,HomeView>(), HomeModule.OnDriverInfoListener {
    override fun gotInfo(driverInfoBean: DriverInfoBean) {
        view?.setDriverInfo(driverInfoBean)
    }

    override fun createModule() {
        module=HomeModule()
        module.listener=this
    }

    fun getLearnInfo(c: Context,token: String?){
        module.getLearnInfo(c, token)

    }
    fun getUnReadNum(c: Context,token: String?){
        module.getUnReadNum(c, token)
    }

    override fun gotUnreadNum(unReadNumBean: UnReadNumBean) {
        view?.setUnReadNum(unReadNumBean)
    }

    override fun gotLearnInfo(learInfoBean: LearInfoBean) {
        view?.setLearn(learInfoBean)
    }

    fun getInfo(c:Context, token:String?){
        module?.getDriveInfo(c, token)
    }
}